<?php
/*
 * @Author: 哲学家乔布斯 <wuyangii@qq.com>
 * @Date: 2022-10-20 21:41:37
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-11-07 22:37:15
 * @Descripttion: 订单
 */

namespace app\api\controller\user\v1_0\driver;


use think\Db;
class OrderInfo extends \app\api\controller\user\v1_0\Common
{
    protected $noNeedRight = ['test'];
    /**
     * @Author: 哲学家乔布斯 <wuyangii@qq.com>
     * @brief: 取货
     * @return 
     * @Descripttion: 确认订单
     */    
    public function info(){
        $id = request()->param('id');
        $order = (new \app\common\model\DriverQOrder())->where(['id' => $id])->find();
        $info = (new \app\common\model\UserOrders())
                    ->alias("order")
                    ->join("{$this->tdb}user_orders_goods order_goods","order_goods.order_id = order.id")
                    ->where(['order.q_order_id' => $order['id']])
                    ->append([
                        'addtime_text','state_text','driver_q_title','driver_title',
                        'driver_q_state_text','driver_state_text','bus_state_text','goods_info'
                        ])
                    ->select();
        return self::successResult("成功",[
            'info' => $info,
            'order' => $order
        ]);

    }
     /**
     * @Author: 哲学家乔布斯 <wuyangii@qq.com>
     * @brief: 送货
     * @return 
     * @Descripttion: 
     */    
    public function info_s(){
        $id = request()->param('id');
        $order = (new \app\common\model\DriverSOrder())->where(['id' => $id])->find();
        $info = (new \app\common\model\UserOrders())
                    ->alias("order")
                    ->join("{$this->tdb}user_orders_goods order_goods","order_goods.order_id = order.id")
                    ->where(['order.s_order_id' => $order['id']])
                    ->append([
                        'addtime_text','state_text','driver_q_title','driver_title',
                        'driver_q_state_text','driver_state_text','bus_state_text','goods_info'
                        ])
                    ->select();
        return self::successResult("成功",[
            'info' => $info,
            'order' => $order
        ]);

    }

    
    

}
